import csv 
import json

stock_id2info = {}
with open("../../stock_id.csv") as f:
    reader = csv.reader(f)
    for row in reader:
        try:
            # print(row[3])
            stockid = int(row[3])
            if stockid not in stock_id2info:
                stock_id2info[stockid] = [row[4], row[2], row[5], row[6]]
            else:
                print("repeated company", stockid)
        except:
            print("not row: ", row[3])
            # pass
        
with open("../sample-data/stock_id2info.json", 'w') as f:
    json.dump(stock_id2info, f, ensure_ascii=False, indent=4)